package com.esri.core.tasks.ags.geoprocessing;

import com.esri.core.internal.io.handler.h;
import com.esri.core.internal.tasks.TaskListener;
import com.esri.core.internal.tasks.d;
import com.esri.core.io.EsriServiceException;
import com.esri.core.io.UserCredentials;

/* loaded from: classes.dex */
public class GPGetJobResultTask extends d<GPParameter> {
    private static final long serialVersionUID = 1;

    public GPGetJobResultTask(GPGetJobResultParameters gPGetJobResultParameters, String str, UserCredentials userCredentials) {
        this(gPGetJobResultParameters, str, userCredentials, null);
    }

    public GPGetJobResultTask(GPGetJobResultParameters gPGetJobResultParameters, String str, UserCredentials userCredentials, TaskListener<GPParameter> taskListener) {
        super(gPGetJobResultParameters, str, userCredentials, taskListener);
        if (gPGetJobResultParameters == null) {
            throw new EsriServiceException("The geoprocess get result task requires input parameters");
        }
        if (gPGetJobResultParameters.validate()) {
            return;
        }
        setActionInput(null);
    }

    @Override // com.esri.core.internal.tasks.a
    public GPParameter execute() throws Exception {
        GPGetJobResultParameters gPGetJobResultParameters = (GPGetJobResultParameters) getActionInput();
        return GPParameter.createFromJson(h.a(this.serviceURL + "/jobs/" + gPGetJobResultParameters.getJobResource().getJobID() + "/results/" + gPGetJobResultParameters.getParameterName(), gPGetJobResultParameters.generateRequestParams(), getServiceCredentials()));
    }
}
